<?php
	require('config.php');
	$title = $_POST['title'];
	$option = $_POST['option'];
	$deadDate = $_POST['deadDate'];
	$description = $_POST['description'];
	// $title = "xxxxx";
	// $option = 1;
	// $deadDate = "2014-9-20";
	// $description = "xxxxxx";
	$insert_query = "insert into vote_subject (title,deadDate,options,description,state)values('$title','$deadDate',$option,'$description','未开始')";
	$get_vsid_query="select max(vsID) from vote_subject";
	$result_query = mysql_query($insert_query);
	if($result_query>0){
		$result_get_vsid=mysql_query($get_vsid_query) or die(mysql_error());
		$row=mysql_fetch_array($result_get_vsid);
		$arr['success']=1;
		$arr['vsid']=$row[0];	
	}else{ 
		$arr['success']=0;
	}
	
	echo json_encode($arr);


	
?>